package org.lk.param;

import cn.hutool.db.Db;
import cn.hutool.db.DbUtil;
import cn.hutool.db.Entity;
import cn.hutool.db.ds.simple.SimpleDataSource;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.sql.SQLException;
import java.util.List;

/**
 * @author lk
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LogParam {
    /**
     * 日志触发时间
     */
    private long logDateTime;
    /**
     * 日志Id
     */
    private long logId;
    /**
     * 从那行开始读取数据
     */
    private int fromLineNum;

    public static void main(String[] args) throws SQLException {
        SimpleDataSource simpleDataSource = new SimpleDataSource(
                "jdbc:mysql://172.16.11.183:3306/ocean_etl","root","root",
                "com.mysql.cj.jdbc.Driver"
        );
        Db use = DbUtil.use(simpleDataSource);
        List<Entity> query = use.query("show variables like 'log_bin'");
        for (Entity entity : query) {
            String value = entity.getStr("value");
            System.out.println(value);
        }
        System.out.println(query);
    }

    public static void test() {
        try {
            int i = 1 / 0;
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
}
